package com.xiaoma.lock.condition.usecase;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;

public class ConditionNotify implements Runnable{

  private ReentrantLock lock;
  private Condition condition;

  public ConditionNotify(ReentrantLock lock, Condition condition) {
    this.lock = lock;
    this.condition = condition;
  }

  @Override
  public void run() {
      try {
        lock.lock();
        System.out.println("开始notify");
        condition.signal();
        System.out.println("结束notify");
      } finally {
        lock.unlock();
      }

  }
}
